package basic;

import java.util.Scanner;

import org.junit.Test;

public class PrintTest {
	@Test  // 注解 annotation
	public void print() {
		// 输出不换行
		System.out.print(123 + 456);
		System.out.print("abc" + 123 + 456); // "abc123456"
		System.out.println("abc" + 123 + 456); // "abc123456"
		// 格式化输出
		int age = 10;
		String name = "zs";
		char sex = '男';
		System.out.println("姓名=" + name + ",年纪=" + age + ",性别=" + sex);
		// %s:String, %d:整数，%c：字符， %f:浮点，%b:布尔
		System.out.format("姓名=%s,年纪=%d,性别=%c\n",name,age,sex);
	}
	
	@Test
	public void scanner() {
		// IO阻塞的
		Scanner scan = new Scanner(System.in);
		int nextInt = scan.nextInt();
		System.out.println(nextInt);
		
		// next遇到空白就断开      zhang san
		String string = scan.next(); // zhang
		// nextLine遇到回车才断开   zhang san
		String string2 = scan.nextLine();
	}

}




